﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Controls;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;

namespace YArchitech.MEP
{
	public partial class ClearGPSProtectRangeForm : System.Windows.Forms.Form
	{
		public ClearGPSProtectRangeForm(ExternalCommandData commandData)
		{
			this.cmmData = commandData;
			this.InitializeComponent();
			new YJKProcessTools().ShowInTaskbarChange(this);
		}

		private void ClearGPSProtectRangeForm_Load(object sender, EventArgs e)
		{
			this.checkBoxSprinklers.Checked = true;
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			if (this.checkBoxSprinklers.Checked && this.checkBoxMechanicalEquip.Checked)
			{
				ElementCategoryFilter item = new ElementCategoryFilter(BuiltInCategory.OST_Sprinklers);
				ElementCategoryFilter item2 = new ElementCategoryFilter(BuiltInCategory.OST_MechanicalEquipment);
				List<ElementCategoryFilter> collection = new List<ElementCategoryFilter>
				{
					item,
					item2
				};
				this.filterList.AddRange(collection);
				base.DialogResult = DialogResult.OK;
			}
			else if (this.checkBoxSprinklers.Checked && !this.checkBoxMechanicalEquip.Checked)
			{
				ElementCategoryFilter item3 = new ElementCategoryFilter(BuiltInCategory.OST_Sprinklers);
				this.filterList.Add(item3);
				base.DialogResult = DialogResult.OK;
			}
			else
			{
				if (!this.checkBoxMechanicalEquip.Checked || this.checkBoxSprinklers.Checked)
				{
					YJKMessageBox.Show("您好，清除保护范围对象的类型不允许为空！", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
					return;
				}
				ElementCategoryFilter item4 = new ElementCategoryFilter(BuiltInCategory.OST_MechanicalEquipment);
				this.filterList.Add(item4);
				base.DialogResult = DialogResult.OK;
			}
			base.Close();
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		public List<ElementFilter> FilterList
		{
			get
			{
				return this.filterList;
			}
		}

		private ExternalCommandData cmmData;

		private List<ElementFilter> filterList = new List<ElementFilter>();
	}
}
